package com.example.recordingpen_datacollection.service.impl;

import com.example.recordingpen_datacollection.Utils.DateUtils.DateUtil;
import com.example.recordingpen_datacollection.entity.Frequency;
import com.example.recordingpen_datacollection.mapper.FrequencyMapper;
import com.example.recordingpen_datacollection.service.FrequencyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author xg
 * @since 2023-11-15
 */
@Service
public class FrequencyServiceImpl extends ServiceImpl<FrequencyMapper, Frequency> implements FrequencyService {
    @Resource
    private FrequencyMapper frequencyMapper;

    @Override
    public void refreshLlgin() {
        frequencyMapper.refreshLlgin();
    }

    /* 每两秒执行一次 */
//    @Scheduled(cron = "0 0 0-23/2 * * ?")
    public void scheduledTasks() {
        this.refreshLlgin();
        String s = DateUtil.stampToDate(System.currentTimeMillis()/1000, "yyyy-MM-dd HH:mm:ss.SSS");
        System.out.println(s);
    }
}
